<?php
$host="db.seng.uvic.ca"; // Host name
$username="se321g01"; // Mysql username
$password="un8bi2YM"; // Mysql password
$db_name="se321g01"; // Database name
$tbl_name="user_info"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form
$myusername=$_POST['txtAccountName'];
$mypassword=$_POST['txtPassword'];
$uid=$_GET['uid'];

$sql="UPDATE user_info SET ba_name = '$myusername', ba_passwd = '$mypassword', ba = '2' WHERE uid = '$uid'";
mysql_query($sql);

// Add user history
mysql_query("INSERT INTO user_history (day_stamp, points, item, uid) VALUES
(CURDATE(), '0', 'Created business account $myusername', '$uid')");

// Go back to profile
header("location:./profile.php?uid=" . $uid . "&tab=4");

?>
